package com.jsmile.cloud.tradecenter.api.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 支付类型(枚举)
 *
 * @author Morily
 */
@Getter
@AllArgsConstructor
public enum OrderStatusEnum {

    TO_PAY(1, "待支付"), TO_DELIVERY(2, "待发货"), TO_SIGN(3, "待签收"), FINISH(4, "完成"), CLOSE(5, "关闭"), REFUND(6, "退款完成 (仅用于发送mq消息,不做状态标识)"), UNKONW(0, "未知（无用）"),;

    /**
     * 值
     */
    private int value;
    private String name;

    /**
     * 根据value获取 名称
     */
    public static OrderStatusEnum nameOf(int value) {
        OrderStatusEnum type = null;
        for (OrderStatusEnum rt : OrderStatusEnum.values()) {
            if (rt.getValue() == value) {
                type = rt;
                break;
            }
        }
        return type;
    }
}
